package com.sq.subject.domain.conf;

import com.zaxxer.hikari.util.UtilityElf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author quan
 */
@Configuration
public class ThreadPoolConfig {
    @Bean
    public ThreadPoolExecutor getLabelThreadPool() {
        return new ThreadPoolExecutor(20,100,5,
                TimeUnit.SECONDS,new LinkedBlockingDeque<>(40),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.CallerRunsPolicy());
    }
}
